//
//  LHMGetHeightTool.m
//  LittleMingClassmate
//
//  Created by dllo on 16/7/13.
//  Copyright © 2016年 小铭. All rights reserved.
//

#import "LHMGetHeightTool.h"

@implementation LHMGetHeightTool

+(CGFloat)heightWith:(NSString *)text {
    
    NSDictionary *attributesDic = @{
                                    
                                    NSFontAttributeName : [UIFont systemFontOfSize:17]
                                    
                                    };
    CGRect rect = [text boundingRectWithSize:CGSizeMake([UIScreen mainScreen].bounds.size.width, 998) options:NSStringDrawingUsesLineFragmentOrigin attributes:attributesDic context:nil];
    return rect.size.height;
    
}

+(CGFloat)widthWith:(NSString *)text {
    
    NSDictionary *attributesDic = @{
                                    
                                    NSFontAttributeName : [UIFont systemFontOfSize:17]
                                    
                                    };
    CGRect rect = [text boundingRectWithSize:CGSizeMake(998, [UIScreen mainScreen].bounds.size.height) options:NSStringDrawingUsesLineFragmentOrigin attributes:attributesDic context:nil];
    return rect.size.width;
    
}

+(CGFloat)twoHeightWith:(NSString *)imageName {
    
    NSURL *url = [NSURL URLWithString:imageName];
    
    NSData *data = [NSData dataWithContentsOfURL:url];
    
    UIImage *image = [UIImage imageWithData:data];
    
    CGFloat height = image.size.width / image.size.height * [UIScreen mainScreen].bounds.size.width;
    
    return height;
    
}

@end
